﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace kinect_draw.Class
{
    public static class kinect_helpper
    {
        public static System.Windows.Point MapBodyPointToScreen(this Microsoft.Kinect.CoordinateMapper coordinateMapper, double width, double height, Microsoft.Kinect.CameraSpacePoint position, Microsoft.Kinect.FrameDescription frameDescription, float InferredZPositionClamp = 1.0f)
        {
            if (position.Z < 0)
            {
                position.Z = InferredZPositionClamp;
            }

            Microsoft.Kinect.DepthSpacePoint depthSpacePoint = coordinateMapper.MapCameraPointToDepthSpace(position);
            return new System.Windows.Point(depthSpacePoint.X * width / frameDescription.Width, depthSpacePoint.Y * height / frameDescription.Height);
        }
        public static bool overPoint(this System.Windows.UIElement Element, System.Windows.Point handPosition, double width, double height)
        {
            System.Windows.Point Captrue_point = Element.getPosition();
            if (Captrue_point.X - 10 <= handPosition.X && Captrue_point.X + width + 10 >= handPosition.X && Captrue_point.Y - 10 <= handPosition.Y && Captrue_point.Y + height + 10 >= handPosition.Y)
                return true;
            return false;
        }
    }
}
